package com.grad.webstudy.enums;

import com.grad.webstudy.model.Code;

/**
 * @Description: 对应的docker镜像的名称
 * @Author: zjf
 * @Date: 2020/2/14 11:44.
 */
public enum DockerImagesEnum {

    JAVA(CodeEnum.JAVA.getCodeNumber(), "java-app"),
    GCC(CodeEnum.GCC.getCodeNumber(), "gcc-app"),
    PYTHON(CodeEnum.PYTHON.getCodeNumber(), "python-app"),
    PHP(CodeEnum.PHP.getCodeNumber(), "php-app"),
    RUBY(CodeEnum.RUBY.getCodeNumber(), "ruby-app"),
    KOTLIN(CodeEnum.KOTLIN.getCodeNumber(),"kotlin-app"),
    GO(CodeEnum.GO.getCodeNumber(),"go-app"),
    PERL(CodeEnum.PERL.getCodeNumber(),"perl-app"),
    SWIFT(CodeEnum.SWIFT.getCodeNumber(),"swift-app"),
    ;
    private Integer codeNumber;//代码编号

    private String dockerImageName;//镜像名称


    DockerImagesEnum(Integer codeNumber, String dockerImageName) {
        this.codeNumber = codeNumber;
        this.dockerImageName = dockerImageName;
    }

    public Integer getCodeNumber() {
        return codeNumber;
    }

    public void setCodeNumber(Integer codeNumber) {
        this.codeNumber = codeNumber;
    }

    public String getDockerImageName() {
        return dockerImageName;
    }

    public void setDockerImageName(String dockerImageName) {
        this.dockerImageName = dockerImageName;
    }

    public static String getValue(Integer codeNumber) {
        for (DockerImagesEnum value : DockerImagesEnum.values()) {
            if (value.getCodeNumber() == codeNumber) {
                return value.getDockerImageName();
            }
        }
        return null;
    }
}
